#import <Foundation/Foundation.h>
#include <stdbool.h>
#include <stdio.h>
#import <unistd.h>


@interface SampleClass : NSObject
- (int *)getRandom;
@end

@implementation SampleClass 
- (int *)getRandom {
  static int r[10];
  int i;

  srand((unsigned)time(NULL));
  for (i = 0; i < 10; ++i) {
    r[i] = rand();
    NSLog(@"r[%d] = %d\n", i, r[i]);
  }
  return r;
}
@end

int main()
{
  NSAutoreleasePool *pool;
  pool = [[NSAutoreleasePool alloc] init];
  // write code below

  double balance[5] = {100.0, 200.0, 300.0, 400.0, 500.0};
  double getindex4 = balance[4];
  printf("%f\n", getindex4);

  SampleClass *sample = [[SampleClass alloc] init];
  int *p = [sample getRandom];
  for (int i = 0; i < 10; i++) {
    NSLog(@"*(p + %d) : %d\n", i, *(p + i));
  }


  // don't write code now
  RELEASE(pool);
  return 0;
}

